<template name="storedFunctions">
    {{> pageHeading title=getPageHeading }}
    {{#if isConnected}}
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>{{_ "stored_functions"}}</h5>
                            <div class="ibox-tools">
                                <button id="btnRefreshStoredFunctions" type="button" class="btn btn-sm btn-primary fix-button">
                                    {{_ "refresh"}}
                                </button>
                            </div>
                        </div>
                        <div class="ibox-content">
                            <table id="tblStoredFunctions"
                                   class="table table-striped table-bordered table-hover dataTables-example dataTable"
                                   style="width: 100%">
                                <thead>
                                <tr>
                                    <th>{{_ "name"}}</th>
                                    <th>{{_ "function"}}</th>
                                    <th>{{_ "edit"}}</th>
                                    <th>{{_ "delete"}}</th>
                                </tr>
                                </thead>
                                <tbody>
                                </tbody>
                            </table>
                        </div>
                        <div class="ibox-footer">
                            <div class="row">
                                <div class="col-lg-12">
                                    <button id="btnAddNewStoredFunction"
                                            class="btn btn-block btn-outline btn-primary ladda-button"
                                            type="button"
                                            data-style="contract">
                                        <strong>{{_ "add"}}</strong></button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="modal inmodal" id="editStoredFunctionModal" tabindex="-1" role="dialog" aria-hidden="true"
             style="display: none;">
            <div class="modal-dialog">
                <div class="modal-content animated bounceInRight">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">
                            <span aria-hidden="true">×</span>
                            <span class="sr-only">{{_ "close"}}</span></button>
                        <h4 id="storedFunctionModalTitle" class="modal-title">{{_ "function_name"}}</h4>
                    </div>
                    <div class="modal-body">
                        <form class="form-horizontal">
                            <div class="form-group">
                                <div class="col-lg-12">
                                    <input class="form-control" type="text" placeholder="{{_ "function_name"}}"
                                           id="inputStoredFunctionName"
                                           data-buttonName="btn-primary">
                                </div>
                            </div>
                            <div class="form-group">
                                <div id="divStoredFunction" class="col-lg-12">
                                                <textarea id="txtStoredFunction" placeholder="{{_ "function"}}"
                                                          class="form-control"></textarea>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="modal-footer">
                        <div class="pull-left">
                            <button type="button" class="btn btn-white" data-dismiss="modal">{{_ "close"}}</button>
                        </div>
                        <button id="btnSaveStoredFunction" type="button" data-style="contract"
                                class="btn btn-primary ladda-button">{{_ "save"}}
                        </button>
                    </div>
                </div>
            </div>
        </div>
    {{/if}}
</template>
